package service;

import java.util.List;

import com.sun.jndi.cosnaming.IiopUrl.Address;

import dao.UserAddressDao;
import pojo.UserAddress;

public class UserAddressService {
	public List<UserAddress> getAddressByUserId(String c_name){
		   UserAddressDao adao = new UserAddressDao();
		   List<UserAddress> list = adao.getUserAddressByUserId(c_name);
		   return list;
	   }
	UserAddressDao udao; 
	//添加地址
	public int  add(UserAddress u){
	 udao=new UserAddressDao();
	 int flag=udao.add(u);
	 return flag;
	}
	//删除地址
	public  int  del(int uid){
		udao=new UserAddressDao();
		 int flag=udao.del(uid);
		 return flag;
	}
	//修改收货信息
	public int update(UserAddress user){
		udao=new UserAddressDao();
		 int flag=udao.update(user);
		 return flag;
	}
	//显示收货信息
	public List<UserAddress> showUserAddress(){
		udao=new UserAddressDao();
		List<UserAddress> list= udao.showUserAddress();
		return list;
	}
	//根据uid显示信息
	public UserAddress getUserAddress(int uid){
		udao=new UserAddressDao();
	   UserAddress u=udao.getUserAddress(uid);
	   return u;
		}
	//显示收货信息根据c_name
	public List<UserAddress> showUserAddress(String c_name){
		udao=new UserAddressDao();
		List<UserAddress> list= udao.showUserAddress(c_name);
		return list;
	}
}
